package net.food.weixinpay.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;

/**
 * Created by Administrator on 2017/5/22 0022.
 */

/**
 *  数据库生成订单号
 */
public class GetOrderNo {
    public static String getOrderNo() {
        // SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault());
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.getDefault());
        Date date = new Date();
        String key = format.format(date);
        Random r = new Random();
        key = key + (r.nextInt(899999) + 100000);
        key = key.substring(0, 18);
      /*  Random rand = new Random();*/
        return key.replace("-", "") /*+ ((rand.nextInt(899999)) + 100000)*/;
    }
}
